package com.learn.my;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Test0006 {


    public static void main(String[] args){

        //单线程
        ExecutorService newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor();

        for (int i = 0; i < 20; i++) {
            final  int temp=i;
            newSingleThreadScheduledExecutor.execute(new Runnable() {
                public void run() {
                    System.out.println(Thread.currentThread().getName()+","+temp);
                }
            });
        }
        newSingleThreadScheduledExecutor.shutdown();
    }
}
